// /*
// * To change this template, choose Tools | Templates
// * and open the template in the editor.
// */
//package session.stateless;
//
//import javax.ejb.LocalBean;
//import javax.ejb.Stateless;
//import javax.persistence.EntityManager;
//import javax.persistence.PersistenceContext;
//
//import entity.CustomerEntity;
//import entity.CustomerAccountEntity;
//import entity.PersonEntity;
//import entity.SystemUserEntity;
//import java.util.Date;
//import type.UserTitle;
//
///**
// *
// * @author Andy
// */
//@Stateless
//@LocalBean
//public class CustomerSessionBean {
//
//    // Add business logic below. (Right-click in editor and choose
//    // "Insert Code > Add Business Method")
//    @PersistenceContext
//    private EntityManager em;
//    //PersonEntity person;
//    CustomerAccountEntity customerAccount;
//    SystemUserEntity customerExecutive;
//    CustomerEntity customer;
//    PersonEntity person;
//    Date dateJoined = new Date();
//
//    public CustomerSessionBean() {
//    }
//
//    public void addNewCustomer(String companyName, String jobTitle, String firstName,
//            String lastName, UserTitle title, Long customerExecutiveId, double creditLimit) throws Exception {
//
//        //person = new PersonEntity(firstName, lastName, title);
//       person = new CustomerEntity(firstName, lastName, title);
//        //PersonEntity person = new CustomerEntity(firstName, lastName, title);
//        customerAccount = new CustomerAccountEntity();
//        customerExecutive = em.find(SystemUserEntity.class, customerExecutiveId);
////        if (customerExecutive == null) {
////            throw new Exception("No customer executive assigned.");
////        }
//        person.setFirstName(firstName);
//        customer.setCustomerAccount(customerAccount);
//        customer.setJobTitle(jobTitle);
//        customer.setCompanyName(companyName);
//        //customer.setDateJoined(dateJoined);
//        customer.setBlackListed(false);
//        customer.setCustomerExecutive(customerExecutive);
//        
//        //em.persist(customer);
//        em.persist(person);
//
//    }
//}
//
